'use strict';

module.exports = function createUpdatedCollection(collectionA, objectB) {
  let collectionC=[],collectionD=[];
 
  for(let i of collectionA)
  {
    if(!collectionC[i])
        {
          collectionC[i]={};
          collectionC[i].key=i;
          collectionC[i].count=1;
        }
        else
        collectionC[i].count++;
  }
       //console.log(collectionC);
   
    for(let m in  collectionC){
      //console.log(m)
    for(let j of objectB.value)
    {//console.log(m.key);
    if(collectionC[m].key==j)
    collectionC[m].count=collectionC[m].count-(Math.floor((collectionC[m].count/3)));
    
  }
}//console.log(collectionC);
let result=[];
for(let k in collectionC)
//console.log(collectionC);
//console.log(collectionC.k);属性
//console.log(collectionC[k]);属性值
result.push(collectionC[k]);




return result;  
}
